package com.gensdai.leliang.adapter;


import android.content.Context;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.gensdai.leliang.R;
import com.gensdai.leliang.entity.parseBean.ProductInfo;
import com.gensdai.leliang.utils.ViewHolder;

/**
 * 右边列表 的adapter
 */
public class TypeRightListAdapter extends KimiraAdapter<ProductInfo> {

    LayoutInflater inflater;
    Context context;

    public TypeRightListAdapter(Context context) {
        inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        this.context = context;
    }

    @Override
    public View extralView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_type_right_product,
                    null);
        }

        SimpleDraweeView icon = ViewHolder.GetChars(convertView, R.id.icon);
        TextView title = ViewHolder.GetChars(convertView, R.id.title);

        ProductInfo info = (ProductInfo)getItem(position);

		Uri uri = Uri.parse(info.getLogo());
		icon.setImageURI(uri);

        title.setText(info.getProductName());

//		switch (position) {
//		case 0:
//			uri = Uri.parse("http://d02.res.meilishuo.net/pic/H/1b/fb/dff60bdd5c21507adb4df89ad062_200_200.cc.jpg");
//			break;
//		case 1:
//			uri = Uri.parse("http://d01.res.meilishuo.net/pic/H/d3/d5/ab2321aec190ad2f5d0ba6c308c2_200_200.cc.jpg");
//			break;
//		case 2:
//			uri = Uri.parse("http://d06.res.meilishuo.net/pic/H/09/05/a848b5d888d079bc1d5633c5a661_200_200.cg.jpg");
//			break;
//		case 3:
//			uri = Uri.parse("http://imgtest-dl.meiliworks.com/pic/H/f3/c0/9987e958c37c32263263ab4237cf_382_250.c6.jpg");
//			break;
//		default:
//			break;
//		}
//		icon.setImageURI(uri);

//        icon.setBackgroundResource(R.color.image_placebg_color);

        return convertView;
    }

}
